package router

import (
	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/net/ghttp"
	"web/app/api"
	ctrl "web/app/system/controller"
	_ "web/app/system/model/test"
)

// authHook 鉴权钩子
func authHook(r *ghttp.Request) {
	// 登录相关免鉴权
	switch r.Request.RequestURI {
	case "/v1/login":
		return
	case "/v1/loginOut":
		return
	default:
		// 开启跨域
		r.Response.CORSDefault()
		// 鉴权中间件
		//api.GfJWTMiddleware.MiddlewareFunc()(r)
	}
}

func init() {
	s := g.Server()
	s.Group("/", func(group *ghttp.RouterGroup) {
		group.ALL("/hello", api.Hello)
	}, func(group *ghttp.RouterGroup) {
		group.GET("/userUms", ctrl.UmsUser)
	})
	//group := s.Group("/api/v1")
	//group.GET("/test", test.)
}
